<?php if(isset($_SESSION['user'])){?>
	<div class="container">
		<div class="well">
			<form class="form-horizontal" id="adpost_form" name="adpost_form" method="POST">
				<div class="inner_title">
					<h3>Ad Posting</h3>
				</div>
				<div class="control-group">
					<label class="control-label" for="language">User Email</label>
					<div class="controls">
					<? if(isset($this->session_data['Main_array']['guest_email']) && $this->session_data['Main_array']['guest_email']!=''){?>
						<input type="text" id="guest_email" name="guest_email" value="<? echo $this->session_data['Main_array']['guest_email'];?>">
					<?}else{?>
						<input type="text" id="guest_email" name="guest_email" value="" placeholder="enter guest email">
					<?}?>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label" for="language">Phone Number</label>
					<div class="controls">
					<? if(isset($this->session_data['Main_array']['guest_phone']) && $this->session_data['Main_array']['guest_phone']!=''){?>
						<input type="text" id="guest_phone" name="guest_phone" value="<? echo $this->session_data['Main_array']['guest_phone'];?>">
					<?}else{?>
						<input type="text" id="guest_phone" name="guest_phone" value="" placeholder="enter guest phone number">
					<?}?>
					</div>
				</div>
				<div class="control-group">
						<label class="control-label" for="language">language</label>
					<div class="controls">
					<select id="language" name="language" onChange="return multiLang();">
						<option value="">select language</option>
						<? if(isset($this->all_languages) && $this->all_languages->count()>0){?>
						<? foreach($this->all_languages as $languges){ if($this->session_data['Main_array']['language']==$languges->language_id){?>
							<option value="<? echo $languges->language_id;?>" selected="selected"><? echo $languges->language_name;?></option>
						<?}else{?>
							<option value="<? echo $languges->language_id;?>"><? echo $languges->language_name;?></option>
						<?}}}?>						
					</select>
					</div>
				</div>
				<div id="caregorydrop">
					<div class="control-group" >
							<label class="control-label" for="displayName">Category</label>
						<div class="controls" >
							<select id="dropCategory" name="dropCategory" onChange="return getSubcategories('users');">
								<option value="">select category</option>
								<? if(isset($this->all_categories) && $this->all_categories->count()>0){?>
								<? foreach($this->all_categories as $category){ if($this->session_data['Main_array']['dropCategory']==$category->category_id){?>
									<option value="<? echo $category->category_id;?>" selected="selected"><? echo $category->category_name;?></option>
								<?}else{?>
									<option value="<? echo $category->category_id;?>"><? echo $category->category_name;?></option>
								<?}}}?>
							</select>
							<button type="button" class="add_new_btn"  onClick="return addListClick()">Add New Category</button>
							<? if(isset($this->session_data['Main_array']['cat_switching']) && $this->session_data['Main_array']['cat_switching']!=""){?>
								<input type="hidden" id="cat_switching" name="cat_switching" value="1">
							<?}else{?>
								<input type="hidden" id="cat_switching" name="cat_switching" value="1">
							<?}?>
						</div>						
					</div>
					<input type="hidden" id="session_sub_cat" value="<? if(isset($this->session_data['Main_array']['dropSubCategory']) && $this->session_data['Main_array']['dropSubCategory']!=""){echo $this->session_data['Main_array']['dropSubCategory'];}else{}?>">
					<div class="control-group" >
							<label class="control-label" for="dropSubCategory">Sub Category</label>
						<div class="controls">
							<select id="dropSubCategory" name="dropSubCategory">
								<option value="">select sub category</option>
							</select>
						</div>							
					</div>
				</div>	
				<div id="categoryText" style="display: none;">
					<div class="control-group">
							<label class="control-label" for="category">New Category</label>
						<div class="controls">
							<? if(isset($this->session_data['Main_array']['categoryText']) && $this->session_data['Main_array']['categoryText']!=""){?>
								<input type="text" id="categoryText" name="categoryText" placeholder="Category" value="<? echo $this->session_data['Main_array']['categoryText']?>">
							<?}else{?>
								<input type="text" id="categoryText" name="categoryText" placeholder="Category">
							<?}?>
							<button type="button" class="cancel_btn"  onClick="return addListBackClick()">Cancel</button>
						</div>
					</div>
					<div class="control-group">
							<label class="control-label" for="subcategory">New Sub Category</label>
						<div class="controls">
						<? if(isset($this->session_data['Main_array']['subCategoryText']) && $this->session_data['Main_array']['subCategoryText']!=""){?>
							<input type="text" id="subCategoryText" name="subCategoryText" placeholder="Sub Category" value="<? echo $this->session_data['Main_array']['subCategoryText']?>">
						<?}else{?>
							<input type="text" id="subCategoryText" name="subCategoryText" placeholder="Sub Category" value="">
						<?}?>
						</div>
					</div>
				</div>	
				<div class="control-group" >
							<label class="control-label" for="district">District</label>
						<div class="controls" >
							<input type="hidden" id="districts" name="districts" value="<? if(isset($this->session_data['Main_array']['districts']) && $this->session_data['Main_array']['districts']!=""){echo $this->session_data['Main_array']['districts'];}else{ echo $this->dist_id;}?>">
							<input type="text" id="district_name" name="district_name" value="<? if(isset($this->session_data['Main_array']['district_name']) && $this->session_data['Main_array']['district_name']!=""){echo $this->session_data['Main_array']['district_name'];}else{echo $this->dist_name;}?>">							
						</div>						
				</div>
				<div class="control-group" >
							<label class="control-label" for="Area">Area</label>
						<div class="controls" >
							<input type="hidden" id="areas" name="areas" value="<? if(isset($this->session_data['Main_array']['areas']) && $this->session_data['Main_array']['areas']!=""){echo $this->session_data['Main_array']['areas'];}else{ echo $this->area_id;}?>">
							<input type="text" id="area_name" name="area_name" value="<? if(isset($this->session_data['Main_array']['areas']) && $this->session_data['Main_array']['areas']!=""){echo $this->session_data['Main_array']['area_name'];}else{ echo $this->area_name;}?>">							
						</div>						
				</div>
				<div class="control-group" >
							<label class="control-label" for="location">Location</label>
						<div class="controls" >
							<select id="location" name="location" onChange="return getLocationBasedPaper('f_Paper')">
								<option value="">select location</option>
								<? if(count($this->getalllocations )>0){ foreach($this->getalllocations as $loc){?>
									<? if($this->session_data['Main_array']['location']==$loc->location_id){?>
									<option value="<? echo $loc->location_id;?>" selected="selected"><? echo $loc->location_name;?></option>
									<?}else{?>
									<option value="<? echo $loc->location_id;?>"><? echo $loc->location_name;?></option>
									<?}?>
								<?}?>
								<?}?>								
							</select>
						</div>						
				</div>
				<div class="" style="background:#f5f5f5;padding-bottom:1px">
				<div class="control-group">
				<label class="control-label" for="location">Ad Type</label>
				<div class="controls">
					<? if($this->list_admodes->count()>0){
						foreach($this->list_admodes as $adMode){?>
						<? if($adMode->ads_type_name=='Print Paper'){?>
							<label class="checkbox inline">	
								<? if(isset($this->session_data['Print_Paper']['paper_print']) && $this->session_data['Print_Paper']['paper_print']=='Print Paper'){?>
									<input type="checkbox" checked="checked" id="printPaper" name="paper_print" value="<? echo $adMode->ads_type_name;?>" onClick="return clickAdmode('<? echo $adMode->ads_type_name;?>','users');"><? echo $adMode->ads_type_name;?>
								<?}else{?>								
								<input type="checkbox" id="printPaper" name="paper_print" value="<? echo $adMode->ads_type_name;?>" onClick="return clickAdmode('<? echo $adMode->ads_type_name;?>','users');"><? echo $adMode->ads_type_name;?>								
								<?}?>
								<input type="hidden" id="sur_charge_paper" name="paper_sur_charge" value="<? echo $adMode->amount_ad_type;?>">
							</label>
						<?}else if($adMode->ads_type_name=='Magazine'){?>
							<label class="checkbox inline">
								<? if(isset($this->session_data['Magazine']['magazine_magazineCheck']) && $this->session_data['Magazine']['magazine_magazineCheck']=='Magazine'){?>
									<input type="checkbox" checked="checked" id="magazineCheck" name="magazine_magazineCheck" value="<? echo $adMode->ads_type_name;?>" onClick="return clickAdmode('<? echo $adMode->ads_type_name;?>','users');"><? echo $adMode->ads_type_name;?>
								<?}else{?>
									<input type="checkbox" id="magazineCheck" name="magazine_magazineCheck" value="<? echo $adMode->ads_type_name;?>" onClick="return clickAdmode('<? echo $adMode->ads_type_name;?>','users');"><? echo $adMode->ads_type_name;?>
								<?}?>
								<input type="hidden" id="sur_charge_magazine" name="magazine_sur_charge_magazine" value="<? echo $adMode->amount_ad_type;?>" >
							</label>
						<?}else if($adMode->ads_type_name=='Home Delivery'){?>
							<label class="checkbox inline">
								<? if(isset($this->session_data['Home_delivery']['home_homedelevarycheck']) && $this->session_data['Home_delivery']['home_homedelevarycheck']=='Home Delivery'){?>
									<input type="checkbox" checked="checked" id="homedelevarycheck" name="home_homedelevarycheck" value="<? echo $adMode->ads_type_name;?>" onClick="return clickAdmode('<? echo $adMode->ads_type_name;?>','users');"><? echo $adMode->ads_type_name;?>
								<?}else{?>
									<input type="checkbox" id="homedelevarycheck" name="home_homedelevarycheck" value="<? echo $adMode->ads_type_name;?>" onClick="return clickAdmode('<? echo $adMode->ads_type_name;?>','users');"><? echo $adMode->ads_type_name;?>
								<?}?>
								<input type="hidden" id="sur_charge_home" name="home_sur_charge_home" value="<? echo $adMode->amount_ad_type;?>">
							</label>
						<?}?>
					<?}}?>
				</div>
				</div>	
				<div class="control-group" id="maindiv"> 
					<div class="control-group" id="printpaperdiv" style="display: none;">
						<h4 class="ad_posting">Print Paper</h4>
						<div class="control-group">
								<label class="control-label" for="papaersurcharge">Surchage</label>
							<div class="controls" >
								<span class="surcharge" id="surcharge_paper"></span>
							</div>
						</div>
						<input type="hidden" id="session_paper_id" value="<? if(isset($this->session_data['Print_Paper']['paper_populationpaperdrop']) && $this->session_data['Print_Paper']['paper_populationpaperdrop']!=""){echo $this->session_data['Print_Paper']['paper_populationpaperdrop'];}else{}?>">
						<div class="control-group">
								<label class="control-label" for="papaerpopulation">Population Paper</label>
							<div class="controls" >
								<select id="populationpaperdrop" name="paper_populationpaperdrop" onChange="return getPaperprice('users');">
									<option value="">select population paper</option>
								</select>
								<span id="showPaperAmount"><? if(isset($this->session_data['Print_Paper']['paper_amount']) && $this->session_data['Print_Paper']['paper_amount']!=""){echo $this->session_data['Print_Paper']['paper_amount'].' Rs';}else{}?></span>
								<input type="hidden" id="paper_amount" name="paper_amount" value="<? if(isset($this->session_data['Print_Paper']['paper_amount']) && $this->session_data['Print_Paper']['paper_amount']!=""){echo $this->session_data['Print_Paper']['paper_amount'];}else{}?>">
							</div>
						</div>
						<div class="control-group">
								<label class="control-label" for="title">Title</label>
							<div class="controls">
								<? if(isset($this->session_data['Print_Paper']['paper_title_paper']) && $this->session_data['Print_Paper']['paper_title_paper']!=''){?>
									<input type="text" id="title_paper" name="paper_title_paper" value="<? echo $this->session_data['Print_Paper']['paper_title_paper'];?>" placeholder="Title">
								<?}else{?>
									<input type="text" id="title_paper" name="paper_title_paper" placeholder="Title">
								<?}?>
							</div>
						</div>
						<div class="control-group">
							<div class="controls" >
								<label class="checkbox inline">
									<input type="checkbox" id="imagePaperId" name="paper_imagePaperId">Image
								</label>									
								<div id="imagePaperSubDiv" style="display: none;">
									<input type="file" id="paperupload" name="paper_paperupload" onChange="return checkDimensions('paper','users')">
									 <select class= "ad_select_w" id="avi_dimensions" name="paper_avi_dimensions"><option value="">Please see the Available Dimensions <? if($this->list_image_dimensions->count()>0){
									foreach($this->list_image_dimensions as $dimensions){?>
									<option value="<? echo $dimensions->image_dimension_id;?>"><? echo $dimensions->image_dimension;?></option>
									<?}}?><br/>
									<input type="hidden" id="price_dimension_paper" name="paper_price_dimension_paper" value="">
									<input type="hidden" id="checkImage_paper" value="1">
									<span id="paperImage"></span>
								</div>
							</div>
						</div>
						<div class="control-group">
								<label class="control-label" for="description">Description</label>
							<div class="controls">
								<? if(isset($this->session_data['Print_Paper']['paper_textAreaPaper']) && $this->session_data['Print_Paper']['paper_textAreaPaper']!=''){?>
									<textarea style="color:#000000" type="text" id="textAreaPaper" name="paper_textAreaPaper" onkeypress="return lengthLetter('print_paper',event,'users');" onblur="return getPriceLetters('print_paper','users');"><? echo $this->session_data['Print_Paper']['paper_textAreaPaper'];?></textarea>
								<?}else{?>
									<textarea style="color:#000000" type="text" id="textAreaPaper" name="paper_textAreaPaper" onkeypress="return lengthLetter('print_paper',event,'users');" onblur="return getPriceLetters('print_paper','users');"></textarea>
								<?}?>								
								&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Letters&nbsp;&nbsp;<span id="lengthPaper"><? if(isset($this->session_data['Print_Paper']['paper_length_paper']) && $this->session_data['Print_Paper']['paper_length_paper']!=''){ echo $this->session_data['Print_Paper']['paper_length_paper'];}?></span>
								<input type="hidden" id="length_paper" name="paper_length_paper" value="<? if(isset($this->session_data['Print_Paper']['paper_length_paper']) && $this->session_data['Print_Paper']['paper_length_paper']!=''){ echo $this->session_data['Print_Paper']['paper_length_paper'];}?>">&nbsp;&nbsp;<span id="price_leeters_paper"><? if(isset($this->session_data['Print_Paper']['paper_letter_price']) && $this->session_data['Print_Paper']['paper_letter_price']!=''){ echo $this->session_data['Print_Paper']['paper_letter_price'].' Rs';}?></span>
								<input type="hidden" id="paper_letter_price" name="paper_letter_price" value="<? if(isset($this->session_data['Print_Paper']['paper_letter_price']) && $this->session_data['Print_Paper']['paper_letter_price']!=''){ echo $this->session_data['Print_Paper']['paper_letter_price'];}?>">
								</div>
								<label class="control-label" for="description">Choose a text color</label>
								<div class="controls">
								<select id="paper_text_color" name="paper_text_color" onChange="textColorChange('paper','users')">
									<option value="">Choose a text color</option>
									<? if($this->session_data['Print_Paper']['paper_text_color_db']=='#FF0000'){?>
										<option value="#FF0000"selected="selected">Red</option>
										<option value="#00FFFF">Cyan</option>
										<option value="#0000FF">Blue</option>
										<option value="#808080">Grey</option>
										<option value="#800080">Purple</option>
										<option value="#008000">Green</option>
										<option value="#800000">Maroon</option>
									<?}else if($this->session_data['Print_Paper']['paper_text_color_db']=='#00FFFF'){?>
										<option value="#FF0000">Red</option>
										<option value="#00FFFF"selected="selected">Cyan</option>
										<option value="#0000FF">Blue</option>
										<option value="#808080">Grey</option>
										<option value="#800080">Purple</option>
										<option value="#008000">Green</option>
										<option value="#800000">Maroon</option>
									<?}else if($this->session_data['Print_Paper']['paper_text_color_db']=='#0000FF'){?>
										<option value="#FF0000">Red</option>
										<option value="#00FFFF">Cyan</option>
										<option value="#0000FF"selected="selected">Blue</option>
										<option value="#808080">Grey</option>
										<option value="#800080">Purple</option>
										<option value="#008000">Green</option>
										<option value="#800000">Maroon</option>
									<?}else if($this->session_data['Print_Paper']['paper_text_color_db']=='#808080'){?>
										<option value="#FF0000">Red</option>
										<option value="#00FFFF">Cyan</option>
										<option value="#0000FF">Blue</option>
										<option value="#808080"selected="selected">Grey</option>
										<option value="#800080">Purple</option>
										<option value="#008000">Green</option>
										<option value="#800000">Maroon</option>
									<?}else if($this->session_data['Print_Paper']['paper_text_color_db']=='#800080'){?>
										<option value="#FF0000">Red</option>
										<option value="#00FFFF">Cyan</option>
										<option value="#0000FF">Blue</option>
										<option value="#808080">Grey</option>
										<option value="#800080"selected="selected">Purple</option>
										<option value="#008000">Green</option>
										<option value="#800000">Maroon</option>
									<?}else if($this->session_data['Print_Paper']['paper_text_color_db']=='#008000'){?>
										<option value="#FF0000">Red</option>
										<option value="#00FFFF">Cyan</option>
										<option value="#0000FF">Blue</option>
										<option value="#808080">Grey</option>
										<option value="#800080">Purple</option>
										<option value="#008000"selected="selected">Green</option>
										<option value="#800000">Maroon</option>
									<?}else if($this->session_data['Print_Paper']['paper_text_color_db']=='#800000'){?>
										<option value="#FF0000">Red</option>
										<option value="#00FFFF">Cyan</option>
										<option value="#0000FF">Blue</option>
										<option value="#808080">Grey</option>
										<option value="#800080">Purple</option>
										<option value="#008000">Green</option>
										<option value="#800000" selected="selected">Maroon</option>
									<?}else{?>
										<option value="#FF0000">Red</option>
										<option value="#00FFFF">Cyan</option>
										<option value="#0000FF">Blue</option>
										<option value="#808080">Grey</option>
										<option value="#800080">Purple</option>
										<option value="#008000">Green</option>
										<option value="#800000">Maroon</option>
									<?}?>
								</select>
								<input type="hidden" id="paper_text_color_db" name="paper_text_color_db" value="<? if(isset($this->session_data['Print_Paper']['paper_text_color_db']) && $this->session_data['Print_Paper']['paper_letter_price']!=''){ echo $this->session_data['Print_Paper']['paper_text_color_db'];}else{?>#000000<? }?>">
							</div>
						</div>						
						<div class="control-group">
							<div class="controls" >
								<label class="radio inline">
								<? if(isset($this->session_data['Print_Paper']['paper_optionsRadios']) && $this->session_data['Print_Paper']['paper_optionsRadios']=='option1'){?>
									<input type="radio" checked="checked" onClick="return showSelectedDays();" name="paper_optionsRadios" id="optionsRadios1" value="option1">
								<?}else{?>
									<input type="radio" checked="checked" onClick="return showSelectedDays();" name="paper_optionsRadios" id="optionsRadios1" value="option1">
								<?}?>
									Start-End dates 
								</label>
								<label class="radio inline">
								<? if(isset($this->session_data['Print_Paper']['paper_optionsRadios']) && $this->session_data['Print_Paper']['paper_optionsRadios']=='option2'){?>
									<input type="radio" name="paper_optionsRadios" checked="checked" onClick="return showStartEndDays();" id="optionsRadios2" value="option2">
								<?}else{?>
									<input type="radio" name="paper_optionsRadios" onClick="return showStartEndDays();" id="optionsRadios2" value="option2">
								<?}?>
									Selected dates
								</label>
							</div>
						</div>
						<div id="start-end">
							<div class="control-group">
									<label class="control-label" for="start">StartDate</label>
								<div class="controls">
								<? if(isset($this->session_data['Print_Paper']['paper_start_date']) && $this->session_data['Print_Paper']['paper_start_date']!=''){?>
									<input type="text" id="start_date" name="paper_start_date" value="<? echo $this->session_data['Print_Paper']['paper_start_date'];?>" />
								<?}else{?>
									<input type="text" id="start_date" name="paper_start_date" value="" />
								<?}?>
								</div>
							</div>
							<div class="control-group">
									<label class="control-label" for="start">EndDate</label>
								<div class="controls">
									<? if(isset($this->session_data['Print_Paper']['paper_end_date']) && $this->session_data['Print_Paper']['paper_end_date']!=''){?>
										<input type="text" id="end_date" name="paper_end_date" value="<? echo $this->session_data['Print_Paper']['paper_end_date'];?>"/>
									<?}else{?>
										<input type="text" id="end_date" name="paper_end_date"/>
									<?}?>
									&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span id="daysId"><? if(isset($this->session_data['Print_Paper']['paper_tot_days_st']) && $this->session_data['Print_Paper']['paper_tot_days_st']!=''){ echo $this->session_data['Print_Paper']['paper_tot_days_st'];}?></span>&nbsp;days
									&nbsp;&nbsp;<span id="weekends_weekdays_st"><? if(isset($this->session_data['Print_Paper']['paper_weekdays_st']) && $this->session_data['Print_Paper']['paper_weekdays_st']!='' && isset($this->session_data['Print_Paper']['paper_weekends_st']) && $this->session_data['Print_Paper']['paper_weekends_st']!=''){  echo '( '.$this->session_data['Print_Paper']['paper_weekdays_st'].' Week Days'.','.$this->session_data['Print_Paper']['paper_weekends_st'].' Week Ends )' ;}?></span>&nbsp;&nbsp;<span id="price_st"><? if(isset($this->session_data['Print_Paper']['paper_week_st_amount']) && $this->session_data['Print_Paper']['paper_week_st_amount']!=''){ echo $this->session_data['Print_Paper']['paper_week_st_amount'];}?></span>
									<input type="hidden" id="tot_days_st" name="paper_tot_days_st" value='<? if(isset($this->session_data['Print_Paper']['paper_tot_days_st']) && $this->session_data['Print_Paper']['paper_tot_days_st']!=''){ echo $this->session_data['Print_Paper']['paper_tot_days_st'];}?>'>
									<input type="hidden" id="weekdays_st" name="paper_weekdays_st" value='<? if(isset($this->session_data['Print_Paper']['paper_weekdays_st']) && $this->session_data['Print_Paper']['paper_weekdays_st']!=''){ echo $this->session_data['Print_Paper']['paper_weekdays_st'];}?>'>
									<input type="hidden" id="weekends_st" name="paper_weekends_st" value='<? if(isset($this->session_data['Print_Paper']['paper_weekends_st']) && $this->session_data['Print_Paper']['paper_weekends_st']!=''){ echo $this->session_data['Print_Paper']['paper_weekends_st'];}?>'>
									<input type="hidden" id="week_st_amount" name="paper_week_st_amount" value='<? if(isset($this->session_data['Print_Paper']['paper_week_st_amount']) && $this->session_data['Print_Paper']['paper_week_st_amount']!=''){ echo $this->session_data['Print_Paper']['paper_week_st_amount'];}?>'>
								</div>
							</div>
						</div>
						<div id="Selected" style="display: none;">
							<div class="control-group">
									<label class="control-label" for="start">Selected Days</label>
								<div class="controls">
								<? if(isset($this->session_data['Print_Paper']['paper_slected_days']) && $this->session_data['Print_Paper']['paper_slected_days']!=''){?>
										<input type="text" id="slected_days" name="paper_slected_days" value="<? echo $this->session_data['Print_Paper']['paper_slected_days'];?>"/>
									<?}else{?>
										<input type="text" id="slected_days" name="paper_slected_days"/>
									<?}?>
									&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span id="select_days"><? if(isset($this->session_data['Print_Paper']['paper_tot_days']) && $this->session_data['Print_Paper']['paper_tot_days']!=''){ echo $this->session_data['Print_Paper']['paper_tot_days'];}?></span>&nbsp;days
									&nbsp;&nbsp;<span id="weekend_weekdays"><? if(isset($this->session_data['Print_Paper']['paper_weekdays']) && $this->session_data['Print_Paper']['paper_weekdays']!='' && isset($this->session_data['Print_Paper']['paper_weekends']) && $this->session_data['Print_Paper']['paper_weekends']!='') { echo '( '.$this->session_data['Print_Paper']['paper_weekdays'].' Week Days'.','.$this->session_data['Print_Paper']['paper_weekends'].' Week Ends )';}?></span>&nbsp;&nbsp;<span id="price_seleted"><? if(isset($this->session_data['Print_Paper']['paper_week_selected_amount']) && $this->session_data['Print_Paper']['paper_week_selected_amount']!=''){ echo $this->session_data['Print_Paper']['paper_week_selected_amount'];}?></span>
									<input type="hidden" id="tot_days" name="paper_tot_days" value='<? if(isset($this->session_data['Print_Paper']['paper_tot_days']) && $this->session_data['Print_Paper']['paper_tot_days']!=''){ echo $this->session_data['Print_Paper']['paper_tot_days'];}?>'>
									<input type="hidden" id="weekdays" name="paper_weekdays" value='<? if(isset($this->session_data['Print_Paper']['paper_weekdays']) && $this->session_data['Print_Paper']['paper_weekdays']!=''){ echo $this->session_data['Print_Paper']['paper_weekdays'];}?>'>
									<input type="hidden" id="weekends" name="paper_weekends" value='<? if(isset($this->session_data['Print_Paper']['paper_weekends']) && $this->session_data['Print_Paper']['paper_weekends']!=''){ echo $this->session_data['Print_Paper']['paper_weekends'];}?>'>
									<input type="hidden" id="week_selected_amount" name="paper_week_selected_amount" value='<? if(isset($this->session_data['Print_Paper']['paper_week_selected_amount']) && $this->session_data['Print_Paper']['paper_week_selected_amount']!=''){ echo $this->session_data['Print_Paper']['paper_week_selected_amount'];}?>'>									
								</div>
							</div>
						</div>
					</div>		
		
					<div class="control-group" id="magazinediv" style="display: none;">
						<h4 class="ad_posting">Magazine</h4>
						<div class="control-group">
								<label class="control-label" for="magazinesurcharge">Surchage</label>
							<div class="controls" >
								<span class="surcharge" id="surcharge_magazine"></span>
							</div>
						</div>
						<div class="control-group">
								<label class="control-label" for="title">Title</label>
							<div class="controls" >
							<? if(isset($this->session_data['Magazine']['magazine_titleMagazine']) && $this->session_data['Magazine']['magazine_titleMagazine']!=""){?>
								<input type="text" id="titleMagazine" name="magazine_titleMagazine" value="<? echo $this->session_data['Magazine']['magazine_titleMagazine'];?>">
							<?}else{?> 
								<input type="text" id="titleMagazine" name="magazine_titleMagazine" value="">
							<?}?>
							</div>
						</div>
						<div class="control-group">
							<div class="controls" >
								<label class="checkbox inline">
									<input type="checkbox" id="imageMagazineId" name="magazine_imageMagazineId">Image
								</label>
								<div id="imageMagzineSubDiv" style="display: none;">
									<input type="file" id="magizenupload" name="magazine_magizenupload" onChange="return checkDimensions('magzine','users')">
									<select class= "ad_select_w" id="avi_dimensions" name="magazine_avi_dimensions"><option value="">Please see the Available Dimensions <? if($this->list_image_dimensions->count()>0){
									foreach($this->list_image_dimensions as $dimensions){?>
									<option value="<? echo $dimensions->image_dimension_id;?>"><? echo $dimensions->image_dimension;?></option>
									<?}}?><br/>
									
									
									<input type="hidden" id="price_dimension_magiz" name="magazine_price_dimension_magiz" value="">
									<input type="hidden" id="checkImage_magazine" value="1">
									&nbsp;<span id="magazineImage"></span>
								</div>
							</div>
						</div>
						<div class="control-group">
								<label class="control-label" for="textArea">Description</label>
							<div class="controls">
								<? if(isset($this->session_data['Magazine']['magazine_textAreaMagazine']) && $this->session_data['Magazine']['magazine_textAreaMagazine']!=""){?>
								<textarea type="text" id="textAreaMagazine" name="magazine_textAreaMagazine" onkeypress="return lengthLetter('ad_magazine',event,'users');" onblur="return getPriceLetters('ad_magazine','users');"><? echo $this->session_data['Magazine']['magazine_textAreaMagazine'];?></textarea>
								<?}else{?>
								<textarea type="text" id="textAreaMagazine" name="magazine_textAreaMagazine" onkeypress="return lengthLetter('ad_magazine',event,'users');" onblur="return getPriceLetters('ad_magazine','users');"></textarea>
								<?}?>
								&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Letters<span id="lengthMagazine"><? if(isset($this->session_data['Magazine']['magazine_length_magazine']) && $this->session_data['Magazine']['magazine_length_magazine']){ echo $this->session_data['Magazine']['magazine_length_magazine'];}?></span>
								<input type="hidden" id="length_magazine" name="magazine_length_magazine" value="<? if(isset($this->session_data['Magazine']['magazine_length_magazine']) && $this->session_data['Magazine']['magazine_length_magazine']){ echo $this->session_data['Magazine']['magazine_length_magazine'];}?>">&nbsp;&nbsp;<span id="price_leeters_magazine"><? if(isset($this->session_data['Magazine']['magazine_letter_price']) && $this->session_data['Magazine']['magazine_letter_price']){ echo $this->session_data['Magazine']['magazine_letter_price'].' RS';}?></span>
								<input type="hidden" id="magazine_letter_price" name="magazine_letter_price" value="<? if(isset($this->session_data['Magazine']['magazine_letter_price']) && $this->session_data['Magazine']['magazine_letter_price']){ echo $this->session_data['Magazine']['magazine_letter_price'];}?>">
							</div>
							<label class="control-label" for="title">Choose a text color</label>
							<div class="controls">
								<select id="magazine_text_color" name="magazine_text_color" onChange="textColorChange('magazine','users')">
									<option value="">Choose a text color</option>
									<? if($this->session_data['Magazine']['magazine_text_color_db']=='#FF0000'){?>
										<option value="#FF0000"selected="selected">Red</option>
										<option value="#00FFFF">Cyan</option>
										<option value="#0000FF">Blue</option>
										<option value="#808080">Grey</option>
										<option value="#800080">Purple</option>
										<option value="#008000">Green</option>
										<option value="#800000">Maroon</option>
									<?}else if($this->session_data['Magazine']['magazine_text_color_db']=='#00FFFF'){?>
										<option value="#FF0000">Red</option>
										<option value="#00FFFF"selected="selected">Cyan</option>
										<option value="#0000FF">Blue</option>
										<option value="#808080">Grey</option>
										<option value="#800080">Purple</option>
										<option value="#008000">Green</option>
										<option value="#800000">Maroon</option>
									<?}else if($this->session_data['Magazine']['magazine_text_color_db']=='#0000FF'){?>
										<option value="#FF0000">Red</option>
										<option value="#00FFFF">Cyan</option>
										<option value="#0000FF"selected="selected">Blue</option>
										<option value="#808080">Grey</option>
										<option value="#800080">Purple</option>
										<option value="#008000">Green</option>
										<option value="#800000">Maroon</option>
									<?}else if($this->session_data['Magazine']['magazine_text_color_db']=='#808080'){?>
										<option value="#FF0000">Red</option>
										<option value="#00FFFF">Cyan</option>
										<option value="#0000FF">Blue</option>
										<option value="#808080"selected="selected">Grey</option>
										<option value="#800080">Purple</option>
										<option value="#008000">Green</option>
										<option value="#800000">Maroon</option>
									<?}else if($this->session_data['Magazine']['magazine_text_color_db']=='#800080'){?>
										<option value="#FF0000">Red</option>
										<option value="#00FFFF">Cyan</option>
										<option value="#0000FF">Blue</option>
										<option value="#808080">Grey</option>
										<option value="#800080"selected="selected">Purple</option>
										<option value="#008000">Green</option>
										<option value="#800000">Maroon</option>
									<?}else if($this->session_data['Magazine']['magazine_text_color_db']=='#008000'){?>
										<option value="#FF0000">Red</option>
										<option value="#00FFFF">Cyan</option>
										<option value="#0000FF">Blue</option>
										<option value="#808080">Grey</option>
										<option value="#800080">Purple</option>
										<option value="#008000"selected="selected">Green</option>
										<option value="#800000">Maroon</option>
									<?}else if($this->session_data['Magazine']['magazine_text_color_db']=='#800000'){?>
										<option value="#FF0000">Red</option>
										<option value="#00FFFF">Cyan</option>
										<option value="#0000FF">Blue</option>
										<option value="#808080">Grey</option>
										<option value="#800080">Purple</option>
										<option value="#008000">Green</option>
										<option value="#800000" selected="selected">Maroon</option>
									<?}else{?>
										<option value="#FF0000">Red</option>
										<option value="#00FFFF">Cyan</option>
										<option value="#0000FF">Blue</option>
										<option value="#808080">Grey</option>
										<option value="#800080">Purple</option>
										<option value="#008000">Green</option>
										<option value="#800000">Maroon</option>
									<?}?>
								</select>
								<input type="hidden" id="magazine_text_color_db" name="magazine_text_color_db" value="<? if(isset($this->session_data['Magazine']['paper_text_color_db']) && $this->session_data['Magazine']['paper_letter_price']!=''){ echo $this->session_data['Magazine']['paper_text_color_db'];}else{?>#000000<? }?>">
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" for="Distance">DeliveryDate</label>
							<div class="controls">
							<? if(isset($this->session_data['Magazine']['magazine_start_date']) && $this->session_data['Magazine']['magazine_start_date']!=""){?>
								<input type="text" id="magazine_start_date" name="magazine_start_date" value="<? echo $this->session_data['Magazine']['magazine_start_date'];?>"/>
							<?}else{?>
								<input type="text" id="magazine_start_date" name="magazine_start_date"/>
							<?}?>
							</div>
						</div>
						<div class="control-group">
								<label class="control-label" for="time">Period Time</label>
							<div class="controls">
								<select id="periodtime" name="magazine_periodtime" onChange="return getAmount_period('users');">
									<option value=''>Select a period time</option>
									<? if($this->list_periodfor_pakages->count()>0){foreach($this->list_periodfor_pakages as $period_packages){
									if($this->session_data['Magazine']['magazine_periodtime']){?>
										<option value="<? echo $period_packages->period_pakage_id;?>" selected="selected"><? echo $period_packages->period_name;?></option>
									<?}else{?>
										<option value="<? echo $period_packages->period_pakage_id;?>"><? echo $period_packages->period_name;?></option>
									<?}}}?>
								</select>
								<span id="showPeriodAmount"><? if(isset($this->session_data['Magazine']['magazine_period_amount']) && $this->session_data['Magazine']['magazine_period_amount']!=""){echo $this->session_data['Magazine']['magazine_period_amount'].' RS';}?></span>
								<input type="hidden" id="period_amount" name="magazine_period_amount" value="<? if(isset($this->session_data['Magazine']['magazine_period_amount']) && $this->session_data['Magazine']['magazine_period_amount']!=""){echo $this->session_data['Magazine']['magazine_period_amount'];}?>">
							</div>
						</div>
					</div>
					<div class="control-group" id="homedelivarydiv" style="display: none;">
					<h4 class="ad_posting">Home Delivery</h4>
						<div class="control-group">
								<label class="control-label" for="homesurcharge">Surchage</label>
							<div class="controls" >
								<span class="surcharge" id="surcharge_home"></span>
							</div>
						</div>
						<div class="control-group">
								<label class="control-label" for="title">Title</label>
							<div class="controls">
								<? if(isset($this->session_data['Home_delivery']['home_titleHome']) && $this->session_data['Home_delivery']['home_titleHome']!=""){?>
									<input type="text" id="titleHome" name="home_titleHome" value="<? echo $this->session_data['Home_delivery']['home_titleHome'];?>">
								<?}else{?>
									<input type="text" id="titleHome" name="home_titleHome" >
								<?}?>&nbsp;&nbsp;&nbsp;&nbsp;<span id="lengthHomeDelivar"></span>
							</div>
						</div>
						<div class="control-group">
							<div class="controls">
								<label class="checkbox inline">
									<input type="checkbox" id="imageDelivarId" name="home_imageDelivarId">Image
									</label>
									<div id="imageHomeDelivarSub" style="display: none;" >
									<input type="file" id="homeupload" name="home_homeupload" onChange="return checkDimensions('home_delivery','users')">
									<select class= "ad_select_w" id="avi_dimensions" name="home_avi_dimensions"><option value="">Please see the Available Dimensions <? if($this->list_image_dimensions->count()>0){
									foreach($this->list_image_dimensions as $dimensions){?>
									<option value="<? echo $dimensions->image_dimension_id;?>"><? echo $dimensions->image_dimension;?></option>
									<?}}?><br/>
									
									<input type="hidden" id="price_dimension_home" name="home_price_dimension_home" value="">
									<input type="hidden" id="checkImage_home"  value="1">
									&nbsp;<span id="homeImage"></span>
									</div>
							</div>
						</div>
						<div class="control-group">
								<label class="control-label" for="textArea" >Description</label>
							<div class="controls">
							<? if(isset($this->session_data['Home_delivery']['home_textAreaHome']) && $this->session_data['Home_delivery']['home_textAreaHome']!=""){?>
								<textarea type="text" id="textAreaHome" name="home_textAreaHome" onkeypress="return lengthLetter('ad_homedelivery',event,'users');" onblur="return getPriceLetters('ad_homedelivery','users');"><? echo $this->session_data['Home_delivery']['home_textAreaHome'];?></textarea>
							<?}else{?>
								<textarea type="text" id="textAreaHome" name="home_textAreaHome" onkeypress="return lengthLetter('ad_homedelivery',event,'users');" onblur="return getPriceLetters('ad_homedelivery','users');"></textarea>
							<?}?>
								&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Letters<span id="lengthHomedelivery"><? if(isset($this->session_data['Home_delivery']['home_length_home_delivery']) && $this->session_data['Home_delivery']['home_length_home_delivery']!=""){echo $this->session_data['Home_delivery']['home_length_home_delivery'];}?></span>
								<input type="hidden" id="length_home_delivery" name="home_length_home_delivery" value="<? if(isset($this->session_data['Home_delivery']['home_length_home_delivery']) && $this->session_data['Home_delivery']['home_length_home_delivery']!=""){echo $this->session_data['Home_delivery']['home_length_home_delivery'];}?>">&nbsp;&nbsp;<span id="price_leeters_home"><? if(isset($this->session_data['Home_delivery']['home_letter_price']) && $this->session_data['Home_delivery']['home_letter_price']!=""){echo $this->session_data['Home_delivery']['home_letter_price'].' RS';}?></span>
								<input type="hidden" id="home_letter_price" name="home_letter_price" value="<? if(isset($this->session_data['Home_delivery']['home_letter_price']) && $this->session_data['Home_delivery']['home_letter_price']!=""){echo $this->session_data['Home_delivery']['home_letter_price'];}?>">
								</div>
								<label class="control-label" for="title">Choose a text color</label>
							<div class="controls">
							<select id="home_text_color" name="home_text_color" onChange="textColorChange('home','users')">
									<option value="">Choose a text color</option>
									<? if($this->session_data['Home_delivery']['home_text_color_db']=='#FF0000'){?>
										<option value="#FF0000"selected="selected">Red</option>
										<option value="#00FFFF">Cyan</option>
										<option value="#0000FF">Blue</option>
										<option value="#808080">Grey</option>
										<option value="#800080">Purple</option>
										<option value="#008000">Green</option>
										<option value="#800000">Maroon</option>
									<?}else if($this->session_data['Home_delivery']['home_text_color_db']=='#00FFFF'){?>
										<option value="#FF0000">Red</option>
										<option value="#00FFFF"selected="selected">Cyan</option>
										<option value="#0000FF">Blue</option>
										<option value="#808080">Grey</option>
										<option value="#800080">Purple</option>
										<option value="#008000">Green</option>
										<option value="#800000">Maroon</option>
									<?}else if($this->session_data['Home_delivery']['home_text_color_db']=='#0000FF'){?>
										<option value="#FF0000">Red</option>
										<option value="#00FFFF">Cyan</option>
										<option value="#0000FF"selected="selected">Blue</option>
										<option value="#808080">Grey</option>
										<option value="#800080">Purple</option>
										<option value="#008000">Green</option>
										<option value="#800000">Maroon</option>
									<?}else if($this->session_data['Home_delivery']['home_text_color_db']=='#808080'){?>
										<option value="#FF0000">Red</option>
										<option value="#00FFFF">Cyan</option>
										<option value="#0000FF">Blue</option>
										<option value="#808080"selected="selected">Grey</option>
										<option value="#800080">Purple</option>
										<option value="#008000">Green</option>
										<option value="#800000">Maroon</option>
									<?}else if($this->session_data['Home_delivery']['home_text_color_db']=='#800080'){?>
										<option value="#FF0000">Red</option>
										<option value="#00FFFF">Cyan</option>
										<option value="#0000FF">Blue</option>
										<option value="#808080">Grey</option>
										<option value="#800080"selected="selected">Purple</option>
										<option value="#008000">Green</option>
										<option value="#800000">Maroon</option>
									<?}else if($this->session_data['Home_delivery']['home_text_color_db']=='#008000'){?>
										<option value="#FF0000">Red</option>
										<option value="#00FFFF">Cyan</option>
										<option value="#0000FF">Blue</option>
										<option value="#808080">Grey</option>
										<option value="#800080">Purple</option>
										<option value="#008000"selected="selected">Green</option>
										<option value="#800000">Maroon</option>
									<?}else if($this->session_data['Home_delivery']['home_text_color_db']=='#800000'){?>
										<option value="#FF0000">Red</option>
										<option value="#00FFFF">Cyan</option>
										<option value="#0000FF">Blue</option>
										<option value="#808080">Grey</option>
										<option value="#800080">Purple</option>
										<option value="#008000">Green</option>
										<option value="#800000" selected="selected">Maroon</option>
									<?}else{?>
										<option value="#FF0000">Red</option>
										<option value="#00FFFF">Cyan</option>
										<option value="#0000FF">Blue</option>
										<option value="#808080">Grey</option>
										<option value="#800080">Purple</option>
										<option value="#008000">Green</option>
										<option value="#800000">Maroon</option>
									<?}?>
								</select>
								<input type="hidden" id="home_text_color_db" name="home_text_color_db" value="<? if(isset($this->session_data['Home_delivery']['home_text_color_db']) && $this->session_data['Home_delivery']['home_text_color_db']!=''){ echo $this->session_data['Home_delivery']['home_text_color_db'];}else{?>#000000<? }?>">
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" for="Distance">DeliveryDate</label>
							<div class="controls">
								<? if(isset($this->session_data['Home_delivery']['home_start_date']) && $this->session_data['Home_delivery']['home_start_date']!=""){?>
									<input type="text" id="home_start_date" name="home_start_date" value="<? echo $this->session_data['Home_delivery']['home_start_date'];?>"/>
								<?}else{?>
									<input type="text" id="home_start_date" name="home_start_date"/>
								<?}?>
							</div>
						</div>
						<div class="control-group">
								<label class="control-label" for="Distance">Radius/Distance</label>
							<div class="controls">
								<select id="radius" name="home_radius" onChange="return radiusAmount('users');">
									<option value="">Select a radius</option>
									<? if($this->list_radius->count()>0){ foreach($this->list_radius as $radius){
									if($this->session_data['Home_delivery']['home_radius']==$radius->radius_id){?>
										<option value="<? echo $radius->radius_id;?>" selected="selected"><? echo $radius->distance.'km(s)'; ?></option>
									<?}else{?>
										<option value="<? echo $radius->radius_id;?>"><? echo $radius->distance.'km(s)'; ?></option>
									<?}}}?>
								</select>
								<span id="showRadiusAmount"><? if(isset($this->session_data['Home_delivery']['home_radius_amount']) && $this->session_data['Home_delivery']['home_radius_amount']!=""){echo $this->session_data['Home_delivery']['home_radius_amount'].' RS';}?></span>
								<input type="hidden" id="radius_amount" name="home_radius_amount" value="<? if(isset($this->session_data['Home_delivery']['home_radius_amount']) && $this->session_data['Home_delivery']['home_radius_amount']!=""){echo $this->session_data['Home_delivery']['home_radius_amount'];}?>">
							</div>
						</div>
					</div>
					<input type="hidden" id="letter_base_range" name="letter_base_range" value="<? if(isset($this->base_range) && $this->base_range!=""){echo $this->base_range->num_words;}else{}?>">
					<input type="hidden" id="letter_base_range_price" name="letter_base_range_price" value="<? if(isset($this->base_range) && $this->base_range!=""){echo $this->base_range->words_amount;}else{}?>">					
					<input type="hidden" id="ses_current_order" name="ses_current_order" value="<? if(isset($_GET['currentOrder']) && $_GET['currentOrder']!=''){ echo $_GET['currentOrder'];}?>">
				<div class="control-group">
					<div class="controls">
						<button type="button" class="clf_btn"  onClick="return adPostValidations('frenchsee')">Save</button>
					</div>
				</div>
				</div>
				</div>
			</form>
		</div>
	</div>	
	<script>
$( document ).ready(function() {
	getSubcategories('users');
	// if($("#districts").val()!=""){		
		// getDistrictAreas('f_Areas','initial');	
	// }
	if( document.getElementById("printPaper").checked == true )
	{
		var chkAdmode=$("#printPaper").val();
		clickAdmode(chkAdmode,'users');
	}
	if( document.getElementById("magazineCheck").checked == true )
	{
		var chkAdmode=$("#magazineCheck").val();
		clickAdmode(chkAdmode,'users');
	}
	if( document.getElementById("homedelevarycheck").checked == true )
	{
		var chkAdmode=$("#homedelevarycheck").val();
		clickAdmode(chkAdmode,'users');
	}
	if( document.getElementById("optionsRadios1").checked == true )
	{
		showSelectedDays();
	}
	if( document.getElementById("optionsRadios2").checked == true )
	{
		showStartEndDays();	
	}
	});	
</script>
<?php }else{?>
<script>
	window.location=BASE_URL;
</script>
<?php } ?>
 


	